package com.dgw.utils;

import com.dgw.enums.ResultEnum;

@SuppressWarnings("all")
public class ResultUtil {
	
	
	public static Result success(){
		Result result = new Result();
		result.setCode(200);
		result.setMsg("请求成功");
		return result;
	}
	
	public static Result success(Object data){
		Result result = new Result();
		result.setCode(200);
		result.setMsg("请求成功");
		result.setData(data);
		return result;
	}
	
	public static Result error(Integer code,String msg){
		Result result = new Result();
		result.setCode(code);
		result.setMsg(msg);
		return result;
	}
	public static Result error(ResultEnum resultEnum){
		Result result = new Result();
		result.setCode(resultEnum.getCode());
		result.setMsg(resultEnum.getMsg());
		return result;
	}
	public static Result error(Integer code,String msg,Object data){
		Result result = new Result();
		result.setCode(code);
		result.setMsg(msg);
		result.setData(data);
		return result;
	}
}
